#!/bin/sh

while true; do 
    nc -w 1 db 3306 
    ret1=$?
    nc -w 1 redis 6379
    ret2=$?

    if [ $ret1 -eq 0 -a $ret2 -eq 0 ]; then
        break 
    fi
    sleep 1
    echo "waiting for db and redis to start"
done

exec opentelemetry-instrument $@
